//引入vue
import Vue from 'vue';
//引入vue-router
import VueRouter from 'vue-router';
//第三方库需要use一下才能用
Vue.use(VueRouter)

import Home  from '../views/Home.vue';
import Login  from '../views/Login.vue';
import Register from '../views/Register';
import LinkList from "../views/manager/LinkList";
import LinkChart from "../views/ChartPage/LinkChart";
import AddVisits from "../views/ChartPage/AddVisits";
import UserLink from "../views/ChartPage/UserLink";
import LinkRank from "../views/ChartPage/LinkRank";
import PieChart from "../views/ChartPage/PieChart";
import PointChart from "../views/ChartPage/PointChart";
import About from "../views/manager/About";
import UserHome from "../views/user/UserHome";
import Member from "../views/user/Member";
import User from "../views/user/User";
import AdminPage from "../views/manager/AdminPage";
import ManageUsers from "../views/manager/ManageUsers";


//定义routes路由的集合，数组类型
const routes=[
    //单个路由均为对象类型，path代表的是路径，component代表组件
    {
        path:'/Home',
        name:'SL-短链接二维码生成界面',
        component:Home,
        hidden:true
    },
    {
        path:'/PointChart',
        name:'饼图',
        component:PointChart,
        hidden:true
    },
    {
        path:'/PieChart',
        name:'饼图',
        component:PieChart,
        hidden:true
    },
    {
        path:'/LinkChart',
        name:'柱形图界面',
        component:LinkChart,
        hidden:true
    },
    {
        path:'/AddVisits',
        name:'SQ-短链接访问量走势图',
        component:AddVisits,
        hidden:true
    },
    {
        path:'/UserLink',
        name:'SQ-短链接新增用户及访问量折线图',
        component:UserLink,
        hidden:true
    },
    {
        path:'/LinkRank',
        name:'短链接、二维码点击量排名前十柱形图',
        component:LinkRank,
        hidden:true
    },
    {
        path:"/Login",
        name:'管理员登录',
        component:Login,
        hidden:true
    },
    {
        path:'/Register',
        name:'登录管理',
        component:Register
    },
    {
        path:"/AdminPage",
        name:'后台管理',
        component:AdminPage,
        children:[
            {
                path:'/About',
                name:'关于我们',
                component:About,
            },
            {
                path:'/ManageUsers',
                name:'管理员信息',
                component:ManageUsers
            },
            {
                path:'/LinkList',
                name:'链接管理',
                component:LinkList
            },
        ]
    },
    {
        path:'/UserHome',
        name:'链接信息图表',
        component:UserHome,
        children: [
            {
                path:'/User',
                name: '个人用户链接信息',
                component: User
            },
            {
                path:'/Member',
                name:'在线生成链接',
                component: Member
            }
        ]

    },
    {
        path:'',
        redirect:"Home",
        hidden:true
    }

]

//实例化VueRouter并将routes添加进去
const router=new VueRouter({
//ES6简写，等于routes：routes
    routes
});

//抛出这个这个实例对象方便外部读取以及访问
export default router